import { LoraCommParamsSocketData, LoraWorkParamsSocketData, LoraTimeParamsSocketData } from "../types/SocketData";
import { getEquipInfo } from "@/utils/equip";

export const handleLoraParamsReg = (loraParams: LoraCommParamsSocketData | LoraWorkParamsSocketData | LoraTimeParamsSocketData) => {
    const equipInfo = getEquipInfo({ funid: loraParams.sn.replace("-", "_") });
    if (equipInfo) {
        if (loraParams.infotype == "CRFParamMaster" || loraParams.infotype == "CRFLoraParam") {
            equipInfo.lora.comm = loraParams.info;
        } else if (loraParams.infotype == "CRFConfigKTCV2") {
            equipInfo.lora.work = loraParams.info;
        } else if (loraParams.infotype == "CRFLoraTiming") {
            equipInfo.lora.time = loraParams.info;
        }
    }
};
